import React from "react";
import { Link } from 'react-router-dom'
import { Image } from 'antd-mobile'
import './NewsItem.less'
import PropTypes from "prop-types";

const NewsItem = (props)=>{
    let { info}  = props 
    if(!info) return null
    let {id,title,hint,image} = info
    
    return <div className="news-item-box">
        <Link to={{ pathname:`/detail/${id}` }}>
            <div className="content">
                <h4 className="title">{title}</h4>
                {hint ? <p className="author">{hint}</p> : null}
            </div>
            <Image src={image} lazy />
        </Link>
    </div>
}

NewsItem.defaultProps = {
    info:null 
}
NewsItem.propTypes = {
    info:PropTypes.object 
}
export default NewsItem